const http = require('http')

const server = http.createServer()

server.on('request', (req, res) => {
  const url = req.url
  const method = req.method
  const str = `您的请求url是 ${url}, 请求方法是 ${method}`
  console.log(str)
  res.setHeader('Content-Type', 'text/html; charset=utf-8')
  res.end(str)
})

server.listen(80, () => {
  console.log('http server running at http://127.0.0.1')
})